﻿
var connection = require("../../app_modules/dbAccess/mongoConfig.js");

var mongoose = require('mongoose');
//var db = mongoose.connect(connection.getConnectionString("")); //连接test数据库
var db = mongoose.createConnection(connection.getConnectionString(""));

//require('./../../database/MongoConfigString.js');


var Schema = mongoose.Schema; //创建模型【骨架模板】
var userSchema = new Schema({
    loginName: String,
    userName: String,
    password: String,
    telephoe: String,
    email: String,
    qq: String,
    weixin: String,
    babyBirthday: String,
    babySex: String,
});

userSchema.methods.add = function (user, callback) {
    this.loginName = user.loginName;
    this.userName = user.userName;
    this.password = user.password;
    this.telephoe = user.telephoe;
    this.email = user.email;
    this.qq = user.qq;
    this.weixin = user.weixin;
    this.babyBirthday = user.babyBirthday;
    this.babySex = user.babySex;
    this.save(callback);
}


var user = db.model('users', userSchema);
//exports.student=student;
module.exports = user;
